home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CD ROM Paradise Collection 4
/
CD ROM Paradise Collection 4 1995 Nov.iso
/
filutil
/
bfind409.zip
/
BFIND.DOC
next >
Wrap
Text File
|
1994-09-17
|
14KB
|
297 lines
BFIND.DOC
09/17/94
The BFIND.EXE program adds Boolean logic to DOS's FIND command. Features:
* In most ways, identical to DOS FIND command except...
* Adds AND, OR, NOT, and XOR options to searches (finding all lines with
"Apples" or "Bananas", for example)
* Allows you to specify the starting column of the desired string
* Adds a pause (/P) option to have the output pause every 24 lines
* Avoids need to include the search string in quotation marks so you can
use the program more easily in batch commands.
The DOS FIND command allows you to find lines in a text file which contain a
given string. You can also have the program tell you how many lines met the
search criteria without actually viewing them which is an ideal way to find out
how many times a given string appears in your file. You can even use FIND to
tell you how many total lines are in a given file just by requesting a string
that you know will never appear in your file like "#X$S$".
BFIND adds to these capabilities. It gives you the power of AND, OR, NOT, and
XOR allowing you to find any line, for example, that contains both "Apples" and
"Oranges" or to present any lines that contain either "Bananas" and "Pears". In
addition, you can do column-specific searching, finding only those lines, say,
that contain "PRINT" beginning in column 10.
The BFIND.INI file:
BFIND will read a BFIND.INI file if one is found. (You can specify a different
file name if desired.) The file is an ASCII text file that can be created
maintained by hand. The file can consist or one or more command line parameters
(only those that begin with a "/"), one statement per line.
The file can also contain comments which are blank lines or any line beginning
with:
; (semi-colon)
: (colon)
' (quote)
AV looks for the initialization file in your default subdirectory first. It
then searches for it in the subdirectory where the executable was and then goes
through your DOS path.
Passing in "/INULL" skips loading the BFIND.INI file.
CONFIGWS.EXE:
In addition to using the BFIND.INI file, you can permanently change some
defaults within BFIND.EXE by using the older CONFIGWS.EXE program. Currently,
for BFIND only, CONFIGWS.EXE is distributed with the BFIND distribution package
only. In future releases, CONFIGWS.EXE will be dropped from the package.
CONFIGWS.EXE allows you to set the following defaults:
Reverse match criteria: /V or /-V
Show counts only: /C or /-C
Number lines: /N or /-N
Case insensitive: /I or /-I
Pause output: /P or /-P
Include headings: /HEADER or /-HEADER
When setting options, the program will process defaults in the following order:
(1) CONFIGWS.EXE-settable settings
(2) BFIND.INI settings
(3) command-line settings
The *last* settings encountered win.
Syntax:
BFIND [ /V | /-V ] [ /C | /-C ] [ /N | /-N ] [ /I | /-I ] [ /P | /-P ]
[ /-HEADER | /HEADER ] [ /Iinitfile | /INULL ]
{ search } infile [ /? ] [ >filename ]
where:
"/V" says to find those items that do NOT match the specification.
"/-V" is the opposite of /V and is typically the default.
"/C" says to show the count of the items found (no individual lines).
"/-C" is the opposite of /C and is typically the default.
"/N" says to number the output lines.
"/-N" is the opposite of /N and is typically the default.
"/I" says to make it a case-insensitive search.
"/-I" is the opposite of /I and is typically the default.
"/P" says to have the display pause every 24 lines.
"/-P" is the opposite of /P and is typically the default.
"/-HEADER" says to skip the normal -----infile output line.
"/HEADER" is the opposite of /-HEADER and is typically the default.
"/Iinitfile" says to read an initialization file with the file name "initfile".
The file specification *must* contain a period. If no drive or path information
is specified, the program will search for initfile beginning in your default
subdirectory and then going throughout your DOS path. The use of an
initialization file is optional. Initially defaults to "/IBFIND.INI".
"/INULL" says to skip loading the BFIND.INI initialization file.
"search" is described below.
"infile" is the name of the input file.
"/?" or "/HELP" or "HELP" shows you the syntax for the command.
">filename" redirects the output to a text file. This automatically invokes
the /-P option. This is useful for saving the found lines into another
file. For example:
BFIND "Bruce" TEMP.TXT > TEMP2.TXT
BFIND directly supports all FIND options except for allowing multiple file
names; use the DOS FOR command if you want that. Options supported include the
/V, /C, /N, /I (which was added in MS-DOS 5.0), infile, /?, and the redirection
specifications. FIND makes the file name be position sensitive--you cannot put
the infile name before the switches--and BFIND adheres to that rule.
For search, the syntax is:
[ ( ]... search_item [ boolean [ ( ]... search_item [ ) ]...] [ ) ]...
where:
( and ) are used to group items
search_item is shown below
boolean is AND, OR, or XOR (NOT is included with search_item)
for search_item, the syntax is:
[ NOT ] "string" [ column ]
where:
NOT is obvious
string the string to search; the quotation marks are typically not
required unless the string contains a space or a reserved word
column is the column in which the string must be found.
So, let's cover some examples:
BFIND "Bugs Bunny" OR "Elmer Fudd" TEST.TXT
Finds any lines in the file TEST.TXT containing either "Bugs Bunny" or "Elmer
Fudd" in them.
BFIND (Apples or Oranges) AND NOT Pears TEST2.TXT
Finds any lines in the file TEST2.TXT which contain the words "Apples" or
"Oranges" in them and ignores any lines containing "Pears". Note that the
quotes around the search words are not required unless the words include spaces
or unless they could be confused with some other keywords. "BFIND OR OR AND
TEST3.TXT" might cause the program to get confused since "OR" and "AND", which
you want to look for as also keywords.
BFIND /C "Bugs Bunny" AND Martians TEST.TXT
Gives you a total for the number of lines containing both "Bugs Bunny" and
"Martians".
The search string can include any text characters. It can also contain ASCII
codes, created either using the Alt key in combination with the numeric keypad
(e.g. Alt-228 to get a Sigma character) or else by embedding a hexadecimal code
(in the form &Hxx) or a decimal code (in the form \nnn) in the text. You can
get a table of hexadecimal codes at the end of this documentation or by saying
"BFIND /?&H". For example, to find the smiley face character in a file called
TEST.TXT, either of the following work:
BFIND "" TEST.TXT
BFIND \001 TEST.TXT
You can press the Esc character to abort the search early.
Remember that BFIND, unlike FIND, typically doesn't require the search string to
be in quotes. As a result, you can create a text file (presume it's called
C:\BAT\PHONE.TXT) containing phone numbers or something and then create a batch
file (like PHONES.BAT) that looks like this:
BFIND %1 %2 %3 %4 %5 C:\BAT\PHONE.TXT
When you want to find a phone number, you just say "PHONE name". This is a
little more natural that using FIND which would require that you enclose the
name in quotes. You can still use the Boolean operators in BFIND; the batch
file above would allow up to five parameters. Remember, though, if you're doing
multiple-word names (like "Bruce Guthrie"), you have to enclose the name in
quotes or use AND. Both of the following would work with the batch file shown
above (although the second option may produce more hits):
PHONE "Bruce Guthrie"
PHONE Bruce AND Guthrie
Return codes:
BFIND returns the following ERRORLEVEL codes:
0 = no problems, string found
1 = no problems, string not found
255 = syntax problems, file not found, or /? requested
Author:
This program was written by Bruce Guthrie of Wayne Software. It is free for use
and redistribution provided relevant documentation is kept with the program, no
changes are made to the program or documentation, and it is not bundled with
commercial programs or charged for separately. People who need to bundle it in
for-sale packages must pay a $50 registration fee to "Wayne Software" at the
following address.
Additional information about this and other Wayne Software programs can be found
in the file BRUCEymm.DOC which should be included in the original ZIP file.
("ymm" is replaced by the last digit of the year and the two digit month of the
release. BRUCE312.DOC came out in December 1993. This same naming convention
is used in naming the ZIP file that this program was included in.) Comments and
suggestions can also be sent to:
Bruce Guthrie
Wayne Software
113 Sheffield St.
Silver Spring, MD 20910
fax: (301) 588-8986
See BRUCEymm.DOC file for additional contact information.
Foreign users: Please provide an Internet e-mail address in all correspondence.
Decimal and hexadecimal codes:
e.g. "\066\097\116" and "&H426174" both are "Bat"
+---------------------------------------------------------------------------
| dec hex chr | dec hex chr | dec hex chr | dec hex chr | dec hex chr |
+--------------+--------------+--------------+--------------+--------------+
| \000 &H00 nul| \052 &H34 4 | \104 &H68 h | \156 &H9C £ | \208 &HD0 ╨ |
| \001 &H01 | \053 &H35 5 | \105 &H69 i | \157 &H9D ¥ | \209 &HD1 ╤ |
| \002 &H02 | \054 &H36 6 | \106 &H6A j | \158 &H9E ₧ | \210 &HD2 ╥ |
| \003 &H03 | \055 &H37 7 | \107 &H6B k | \159 &H9F ƒ | \211 &HD3 ╙ |
| \004 &H04 | \056 &H38 8 | \108 &H6C l | \160 &HA0 á | \212 &HD4 ╘ |
| \005 &H05 | \057 &H39 9 | \109 &H6D m | \161 &HA1 í | \213 &HD5 ╒ |
| \006 &H06 | \058 &H3A : | \110 &H6E n | \162 &HA2 ó | \214 &HD6 ╓ |
| \007 &H07 bel| \059 &H3B ; | \111 &H6F o | \163 &HA3 ú | \215 &HD7 ╫ |
| \008 &H08 bs | \060 &H3C < | \112 &H70 p | \164 &HA4 ñ | \216 &HD8 ╪ |
| \009 &H09 tab| \061 &H3D = | \113 &H71 q | \165 &HA5 Ñ | \217 &HD9 ┘ |
| \010 &H0A lf | \062 &H3E > | \114 &H72 r | \166 &HA6 ª | \218 &HDA ┌ |
| \011 &H0B vt | \063 &H3F ? | \115 &H73 s | \167 &HA7 º | \219 &HDB █ |
| \012 &H0C pg | \064 &H40 @ | \116 &H74 t | \168 &HA8 ¿ | \220 &HDC ▄ |
| \013 &H0D cr | \065 &H41 A | \117 &H75 u | \169 &HA9 ⌐ | \221 &HDD ▌ |
| \014 &H0E | \066 &H42 B | \118 &H76 v | \170 &HAA ¬ | \222 &HDE ▐ |
| \015 &H0F | \067 &H43 C | \119 &H77 w | \171 &HAB ½ | \223 &HDF ▀ |
| \016 &H10 | \068 &H44 D | \120 &H78 x | \172 &HAC ¼ | \224 &HE0 α |
| \017 &H11 | \069 &H45 E | \121 &H79 y | \173 &HAD ¡ | \225 &HE1 ß |
| \018 &H12 | \070 &H46 F | \122 &H7A z | \174 &HAE « | \226 &HE2 Γ |
| \019 &H13 | \071 &H47 G | \123 &H7B { | \175 &HAF » | \227 &HE3 π |
| \020 &H14 | \072 &H48 H | \124 &H7C | | \176 &HB0 ░ | \228 &HE4 Σ |
| \021 &H15 | \073 &H49 I | \125 &H7D } | \177 &HB1 ▒ | \229 &HE5 σ |
| \022 &H16 | \074 &H4A J | \126 &H7E ~ | \178 &HB2 ▓ | \230 &HE6 µ |
| \023 &H17 | \075 &H4B K | \127 &H7F | \179 &HB3 │ | \231 &HE7 τ |
| \024 &H18 | \076 &H4C L | \128 &H80 Ç | \180 &HB4 ┤ | \232 &HE8 Φ |
| \025 &H19 | \077 &H4D M | \129 &H81 ü | \181 &HB5 ╡ | \233 &HE9 Θ |
| \026 &H1A eof| \078 &H4E N | \130 &H82 é | \182 &HB6 ╢ | \234 &HEA Ω |
| \027 &H1B esc| \079 &H4F O | \131 &H83 â | \183 &HB7 ╖ | \235 &HEB δ |
| \028 &H1C | \080 &H50 P | \132 &H84 ä | \184 &HB8 ╕ | \236 &HEC ∞ |
| \029 &H1D ???| \081 &H51 Q | \133 &H85 à | \185 &HB9 ╣ | \237 &HED φ |
| \030 &H1E ???| \082 &H52 R | \134 &H86 å | \186 &HBA ║ | \238 &HEE ε |
| \031 &H1F ???| \083 &H53 S | \135 &H87 ç | \187 &HBB ╗ | \239 &HEF ∩ |
| \032 &H20 | \084 &H54 T | \136 &H88 ê | \188 &HBC ╝ | \240 &HF0 ≡ |
| \033 &H21 ! | \085 &H55 U | \137 &H89 ë | \189 &HBD ╜ | \241 &HF1 ± |
| \034 &H22 " | \086 &H56 V | \138 &H8A è | \190 &HBE ╛ | \242 &HF2 ≥ |
| \035 &H23 # | \087 &H57 W | \139 &H8B ï | \191 &HBF ┐ | \243 &HF3 ≤ |
| \036 &H24 $ | \088 &H58 X | \140 &H8C î | \192 &HC0 └ | \244 &HF4 ⌠ |
| \037 &H25 % | \089 &H59 Y | \141 &H8D ì | \193 &HC1 ┴ | \245 &HF5 ⌡ |
| \038 &H26 & | \090 &H5A Z | \142 &H8E Ä | \194 &HC2 ┬ | \246 &HF6 ÷ |
| \039 &H27 ' | \091 &H5B [ | \143 &H8F Å | \195 &HC3 ├ | \247 &HF7 ≈ |
| \040 &H28 ( | \092 &H5C \ | \144 &H90 É | \196 &HC4 ─ | \248 &HF8 ° |
| \041 &H29 ) | \093 &H5D ] | \145 &H91 æ | \197 &HC5 ┼ | \249 &HF9 ∙ |
| \042 &H2A * | \094 &H5E ^ | \146 &H92 Æ | \198 &HC6 ╞ | \250 &HFA · |
| \043 &H2B + | \095 &H5F _ | \147 &H93 ô | \199 &HC7 ╟ | \251 &HFB √ |
| \044 &H2C , | \096 &H60 ` | \148 &H94 ö | \200 &HC8 ╚ | \252 &HFC ⁿ |
| \045 &H2D - | \097 &H61 a | \149 &H95 ò | \201 &HC9 ╔ | \253 &HFD ² |
| \046 &H2E . | \098 &H62 b | \150 &H96 û | \202 &HCA ╩ | \254 &HFE ■ |
| \047 &H2F / | \099 &H63 c | \151 &H97 ù | \203 &HCB ╦ | \255 &HFF |
| \048 &H30 0 | \100 &H64 d | \152 &H98 ÿ | \204 &HCC ╠ | |
| \049 &H31 1 | \101 &H65 e | \153 &H99 Ö | \205 &HCD ═ | |
| \050 &H32 2 | \102 &H66 f | \154 &H9A Ü | \206 &HCE ╬ | |
| \051 &H33 3 | \103 &H67 g | \155 &H9B ¢ | \207 &HCF ╧ | |
+--------------+--------------+--------------+--------------+--------------+